<template>
  {{ $utils.addName('你好') }}
</template>

<script setup>
// function getList() {
//   return new Promise((resolve, reject) => {
//     let name = '张三'
//     setTimeout(() => {
//       name = '李四'

//     resolve(name)
//     }, 3000)

//   })
// }

// let name=await getList()
//  getList().then(res=>{
//    console.log(res);
//  })
// console.log(name,456);


let p = new Promise((resolve, reject) => {
  let a1 = '成功的参数'
  let a2 = '失败的参数'
  var time = setTimeout(() => {
    console.log('start')
    resolve(a1)
    reject(a2)
    console.log('end')
  }, 1000)
})

p.then(
  value => {
    console.log('这是resolve函数体,参数:' + value)
  },
  reason => {
    console.log('这是reject函数体,参数:' + reason)
  }
)
</script>
